//
//  DYZMineController.m
//  DYZCars
//
//  Created by MF on 16/8/18.
//  Copyright © 2016年 MF. All rights reserved.
//

#import "DYZMineController.h"
#import "DYZPersonInfoController.h"
#import "DYZMyFocusController.h"
#import "DYZMyDealController.h"
#import "DYZMyCollectController.h"
#import "DYZSystemSettingController.h"

@interface DYZMineController ()

@end

@implementation DYZMineController
- (IBAction)myCheyuanbutton:(id)sender {
    NSLog(@"我的车源");
}
- (IBAction)myMessageButton:(id)sender {
        NSLog(@"我的消息");
}
- (IBAction)myXuncheButton:(id)sender {
        NSLog(@"我的寻车");
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"注销" style:UIBarButtonItemStylePlain target:self action:@selector(logout:)];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)logout:(UIButton *)sender {
    UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"提示" message:nil preferredStyle:UIAlertControllerStyleActionSheet];
    UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"确认退出" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
        [self presentViewController:[[NSClassFromString(@"DYZLoginViewController") alloc] init] animated:(true) completion:nil];
    }];

     UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:nil];
    [alertVC addAction:action1];
    [alertVC addAction:action2];
  
    [self presentViewController:alertVC animated:true completion:nil];
}

#pragma mark - UITableView data source

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"%zd",indexPath.row);
    if (indexPath.row == 0) {
        
        DYZPersonInfoController *vc = [[DYZPersonInfoController alloc] init];
        [self.navigationController pushViewController:vc animated:true];
    } else if(indexPath.row == 2 ) {
//        我的关注
        DYZMyFocusController *vc = [[DYZMyFocusController alloc] init];
        [self.navigationController pushViewController:vc animated:true];
    }else if(indexPath.row == 3 ) {
//        寻车交易
        DYZMyDealController *vc = [[DYZMyDealController alloc] init];
        [self.navigationController pushViewController:vc animated:true];
    }else if(indexPath.row == 4 ) {
//        我的收藏
        DYZMyCollectController *vc = [[DYZMyCollectController alloc] init];
        [self.navigationController pushViewController:vc animated:true];
    }else if(indexPath.row == 5 ) {
//        系统设置
        DYZSystemSettingController *vc = [[DYZSystemSettingController alloc] init];
        [self.navigationController pushViewController:vc animated:true];
    }
}
@end
